package com.ApiBack.springbootinit.service.impl.inner;

import com.ApiBack.springbootinit.common.ErrorCode;
import com.ApiBack.springbootinit.exception.BusinessException;
import com.ApiBack.springbootinit.mapper.UserMapper;
import com.ApiBack.springbootinit.model.entity.User;
import com.ApiBack.springbootinit.service.InnerUserService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.StringUtils;
import org.apache.dubbo.config.annotation.DubboService;

import javax.annotation.Resource;

/**
 * Description:    // 类说明
 *
 * @ClassName: InnerUserServiceImpl    // 类名，会自动填充
 * @Author: 周天赐        // 创建者
 * @Email: m18879004515@163.com
 * @Date: 2024/3/6 11:01   // 时间
 * @Version: 1.0     // 版本
 */
@DubboService
public class InnerUserServiceImpl implements InnerUserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public User getInvokeUser(String accessKey) {

        if (StringUtils.isAnyBlank(accessKey))
        {
            throw new BusinessException(ErrorCode.PARAMS_ERROR);
        }

        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("accessKey", accessKey);
        return  userMapper.selectOne(queryWrapper);

    }
}

    
    
